home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / rexx / 196 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: lade.news.pipex.net!pipex!exnet2!anweald!ph
  2. From: ph@anweald.exnet.co.uk (Patrick Herring)
  3. Newsgroups: comp.lang.rexx
  4. Subject: Re: string to numeric 
  5. Distribution: world
  6. Message-ID: <821288322snx@anweald.exnet.co.uk>
  7. References: <821110610.11snx@wims.ow.nl>
  8. Date: Wed, 10 Jan 96 15:38:42 GMT
  9. Organization: Anweald Systems
  10.  
  11. wim@wims.ow.nl writes in article <821110610.11snx@wims.ow.nl>:
  12. > In article <820350435snx@anweald.exnet.co.uk> ph@anweald.exnet.co.uk writes:
  13. > >
  14. > >dan@camelot.rockefeller.edu writes in article <DK> D30E.A9w@rockyd.rockefeller.ed>u>:
  15. > >> 
  16. > >> Is there a function that can take a variable declared like
  17. > >> 
  18. > >> data = 123
  19. > >> 
  20. > >> and convert it so that the variable's value is actually 123
  21. > >> (that's the number 123, NOT a character string consisting
  22. > >> od ASCII 1 followed by ASCII 2 followed by ASCII 3... which
  23. > >> I think is 31, 32, 33)
  24. > >> 
  25. > >> I need to pass these variables as integers to a device driver.
  26. > >> 
  27. > >> In fact, REXX must have this built in, otherwise how could it
  28. > >> do addition with variables saved as strings?
  29. > >
  30. > >Rexx's arithmetic is defined and implemented as operations on strings, believe>  
  31. > >it or not :-) . This gives a lot of portability at the expense of speed.
  32. > >
  33. > >I think what you mean is 123 as it would be physically in C ie in binary. The > >function d2x( 123 ) gives this (7B).
  34. > This is the Hex value. You can get binary value with d2c(). If you look at
  35. > the output you see "{" .
  36.  
  37. Hmm, yes, elementary mistake by me, oh dear. Still, as Dan said, it's a 
  38. confusing part of Rexx in that the input to d2c() is a char string and you get 
  39. back a binary number. One thing the thread did show up is that there is no one 
  40. thing that is 'really' a number in Rexx. Coming from COBOL I'm not surprised.
  41.  
  42. Yours, Patrick
  43. _____________________________________________________________________________
  44.                         
  45. Patrick Herring, Primrose Hill, London, UK           
  46. I tend to eat my UUCP feed once a day so replies can take two days
  47.